/**
 * Created by zhangligang
 * Email: tzhang2450@163.com
 * Date: 2018/8/22
 * Time: 09:31
 */
$(function(){
    sendAjax('/v1/teacher/file.json', 'get', {}, function(json){
        var teacher = json.body.data;

        $('.file-number').text(teacher.number);
        $('.file-realname').text(teacher.realname);
        var gender = teacher.gender == 0 ? '' : (teacher.gender == 1 ? '男' : '女');
        $('.file-gender').text(gender);
        $('.file-identity').text(teacher.identity);
        $('.file-mobile').text(teacher.mobile);
        $('.file-email').text(teacher.email);
        $('.file-unit').text(teacher.unit_name);
        var join_at = teacher.join_at == '0000-00-00 00:00:00' ? '' : teacher.join_at;
        $('.file-join-at').text(join_at);
        var work_age = teacher.work_age == 0 ? '' : teacher.work_age+'年';
        $('.file-work-age').text(work_age);
        $('.file-education').text(teacher.education);
        $('.file-degree').text(teacher.degree);
        $('.file-job').text(teacher.job);
        $('.file-professional-title').text(teacher.professional_title);
        $('.file-professional-check').text(teacher.professional_check);
        $('.file-duty-on').text(teacher.duty_on);
        $('.file-duty-type').text(teacher.duty_type);
        $('.file-capacity').text(teacher.capacity);
        var marriage = getMarriage(teacher.marriage);
        $('.file-marriage').text(marriage);
        $('.file-spouse-name').text(teacher.spouse_name);
        $('.file-spouse-unit').text(teacher.spouse_unit);
        var has_house = teacher.has_house == 1 ? '有' : '无';
        $('.file-has-house').text(has_house);
        $('.file-remark').text(teacher.remark);
        $('.file-score').text(teacher.score);
    });
});

function getMarriage(marriage) {
    switch (marriage) {
        case 0 : return '';
        case 1 : return '未婚';
        case 2 : return '已婚';
        case 3 : return '离异';
        case 4 : return '丧偶';
        default: return '';
    }
}